<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>收入-流水</title>
    <link rel="stylesheet" href="${ctx}/static/plug/frozenui-1.3.0/css/frozen.css" media="all">
    <link rel="stylesheet" href="${ctx}/static/css/user/register.css" media="all">
    <script src="${ctx}/static/js/laydate/laydate.js"></script>
    <style type="text/css">
        .content {
            padding-top: 10px;
            padding-left: 20px;
            padding-right: 20px
        }

        .demo-block {
            position: relative;
        }

        .demo-block .ui-header,
        .demo-block .ui-footer {
            position: absolute;
        }

        .demo-block > .ui-list, .demo-block > .ui-form, .demo-block > .ui-tooltips {
            margin-bottom: 20px;
        }

    </style>
</head>
<body>

<section class="ui-container">
    <div class="ui-flex  ui-flex-ver ui-flex-pack-center content">

        <div style="margin-top: 50px; margin-left: 10px">
            <h1>账号名称:<span>长沙河西桐梓坡路步步高</span></h1>
        </div>
        <div style="margin-top: 0px; margin-left: 10px">
            <h2 class=""><span>总收入:</span>
                <span class="ui-panel-title-tips"  style="margin-right: 15px;font-size: 18px;" id="spanDateSelected">2017-12-25</span>
            </h2>
        </div>
        <div style="margin: 0 auto; text-align: center">
            <h1 style="font-size: 40px; color: #469fe3">
                ￥<span id="totalAmount"><fmt:formatNumber type="number" value="${parkTransTotalRespVo.totalAmount / 10 }" pattern="0.00"
                                   maxFractionDigits="2"/></span>
            </h1>
        </div>

        <div>
            <ul class="ui-grid-halve">
                <li>
                    <div class="ui-grid-halve-img ui-border-r">
                        <h1 class="ui-txt-info">现金收入:</h1>
                        <p>
                            ￥<span id="cashAmount"><fmt:formatNumber type="number" value="${parkTransTotalRespVo.cashAmount / 10 }"
                                               pattern="0.00" maxFractionDigits="2"/></span>
                        </p>
                        <p>共&nbsp;<span id="cashCount">${parkTransTotalRespVo.cashCount}</span>&nbsp;笔</p>
                    </div>
                </li>
                <li>
                    <div class="ui-grid-halve-img">
                        <h1 class="ui-txt-info">慧付单收入:</h1>
                        <p>
                            ￥<span id="platformAmount"><fmt:formatNumber type="number" value="${parkTransTotalRespVo.platformAmount / 10 }"
                                               pattern="0.00" maxFractionDigits="2"/></span>
                        </p>
                        <p>共&nbsp;<span id="platformCount">${parkTransTotalRespVo.platformCount}</span>&nbsp;笔</p>
                    </div>
                </li>

            </ul>
        </div>
        <div class="ui-notice-btn" style="text-align: center; padding-top: 40px">

            <button id="btnCheckTransDetail" class="ui-btn-lg  ui-btn-primary charge_button" style="border-radius: 5px;"
                    data="">查看详细收入流水
            </button>
            <button id="btnCheckPlatformDetail" class="ui-btn-lg  ui-btn-primary charge_button"
                    style="border-radius: 5px;"
                    data="">查看慧付单收入到账情况
            </button>
        </div>

    </div>
</section>

<section id="dialog">
        <div class="ui-dialog" id="div_dialog">

        </div>
</section>

</body>
<script src="${ctx}/static/plug/frozenui-1.3.0/lib/zepto.min.js"></script>
<script src="${ctx}/static/plug/frozenui-1.3.0/js/frozen.js"></script>
<script>

    var paramObj = {
        "transDetailParams": "${transDetailParams}",//查看详细收入流水
        "transferDetailParams": "${transferDetailParams}",//查看慧付单收入到账情况
        "transTotalParams": "${transTotalParams}"
    };

    function initDateSelected(){
        laydate.render({
            show: true,
            elem: '#div_dialog', //指定元素
            position: 'static',
            showBottom: true,
            btns: ['confirm'],
            done: function (value, date, endDate) {
                $(".ui-dialog").removeClass("show");
                console.log(value); //得到日期生成的值，如：2017-08-18
                $("#spanDateSelected").html(value);
                var paraObj = {
                    "params": paramObj.transTotalParams,
                    "date":value
                };
                $.post("${action}", paraObj, function (obj) {
                    console.log(obj);
                    if(obj.result){
                        //showTips("info", "绑定成功");
                        var parkTransTotalRespVo = obj.data;
                        $("#cashAmount").html(parkTransTotalRespVo.cashAmount/10+".00");
                        $("#cashCount").html(parkTransTotalRespVo.cashCount);
                        $("#platformAmount").html(parkTransTotalRespVo.platformAmount/10+".00");
                        $("#platformCount").html(parkTransTotalRespVo.platformCount);
                        $("#totalAmount").html(parkTransTotalRespVo.totalAmount/10+".00");
                        //var hrefUrl="${action}?params=" + paramObj.enterpriseParams;
                        //window.location.href = hrefUrl;
                    }else{
                        showTips("info", "获取业务数据失败");
                    }
                });
            }

        });
    }

    $(function () {
        var currentDate = new Date().format("yyyy-MM-dd").toString();
        $("#spanDateSelected").val(currentDate);
        initDateSelected();
        $("#spanDateSelected").bind("click", function () {
            $(".ui-dialog").addClass("show");
        });


        $("#btnCheckTransDetail").bind("click", function () {
            var select_date=$("#spanDateSelected").html();
            var hrefUrl = "${action}?params=" + paramObj.transDetailParams+ "&date=" + select_date;;
            window.location.href = hrefUrl;
        });

        $("#btnCheckPlatformDetail").bind("click", function () {
            var hrefUrl = "${action}?params=" + paramObj.transferDetailParams;
            window.location.href = hrefUrl;
        });
    });
</script>
</html>
